package com.zhang.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author zh
 * @create 2022-03-03 17:17
 */
@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {
    @Resource
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/login/**")
                .excludePathPatterns("/user/**")
                .excludePathPatterns("/assets/**")
                .excludePathPatterns("/swagger-ui.html")
                .excludePathPatterns("/shop")
                .excludePathPatterns("/order")
                .excludePathPatterns("/register");
    }
}
